package com.situ.yB2C.task.impl;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import com.situ.yB2C.sequnce.dao.SequnceDao;
import com.situ.yB2C.sequnce.pojo.Sequnce;
import com.situ.yB2C.task.TaskService;

@Service
@EnableScheduling
public class TaskServiceImpl implements TaskService {
	private static final Logger LOG =	LoggerFactory.getLogger(TaskServiceImpl.class);
	@Autowired
	private SequnceDao sequnceDao;

	@Override
	@Scheduled(cron = "0 0 0 * * ?")
	//@Scheduled(cron = "0 32 20 * * ?") //20:32  重置为零
	public void autoJOB4Day() {
		LOG.debug("明天的凌晨0点0分0秒运行的任务调度");
		//用于生成订单编号的子段，应该在明天的凌晨0点0分0秒的时候重置为零
		
		sequnceDao.updateColumn(Sequnce.ORDER_COLUMN_NAME, 0);
	}

}
